package com.example.yuejian.yuejian.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;

import com.example.yuejian.yuejian.R;
import com.example.yuejian.yuejian.view.WaitingView;

/**
 * author hation
 * time 2017/8/3  14:32
 */
public class WebLoadingDialog extends Dialog {
    private WaitingView mLoadingView;
    private Builder mBuilder;
    private WebLoadingDialog(Builder builder) {
        super(builder.mContext, R.style.dialog);
        mBuilder = builder;
        setCancelable(mBuilder.mCancelable);
        setCanceledOnTouchOutside(mBuilder.mCanceledOnTouchOutside);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pupop);

    }
    public static class Builder{
        private Context mContext;
        private boolean mCancelable = true;

        private boolean mCanceledOnTouchOutside = true;
        public Builder(Context context) {
            mContext = context;
        }
        public Builder cancelable(boolean cancelable) {
            mCancelable = cancelable;
            mCanceledOnTouchOutside = cancelable;
            return this;
        }
        public Builder canceledOnTouchOutside(boolean canceledOnTouchOutside) {
            mCanceledOnTouchOutside = canceledOnTouchOutside;
            return this;
        }
        public WebLoadingDialog build(){
            return new WebLoadingDialog(this);
        }
        public WebLoadingDialog show(){
            WebLoadingDialog dialog = build();
            dialog.show();
            return dialog;
        }
    }
}
